<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="l" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" import="java.sql.*" errorPage="" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Lite - Bootstrap Skin</title>
    
    
    <!-- Favicon -->
    <link rel="shortcut icon" href="img/favicon.ico" />
    
    <!-- CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/font-awesome.min.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    
    <!-- Google Fonts -->
    <link href='http://fonts.useso.com/css?family=Titillium+Web' rel='stylesheet' type='text/css'>
	<script language="javascript"> 
		function loadimage(){ 
			document.getElementById("randImage").src = "image.jsp?"+Math.random(); 
		}
		function checkValidate()  
		{   
		 
		  if(document.form1.uname.value==""||document.form1.uname.value==null||(!isName(document.form1.uname.value)))  
		  {  
		  	window.alert("请输入字母开头，长度为5-16，允许字母数字下划线的用户名");  
		  	return false;  
		  }
		  if(document.form1.password.value==""||document.form1.password.value==null)  
		  {  
		  	window.alert("请输入密码");  
		  	return false;  
		  }else if(document.form1.rand.value==""||document.form1.rand.value==null||document.form1.rand.value!=num){
		  	window.alert("请输入正确的验证码");  
		  	
		  	return false;  
		  }else
		  	return true;
		  
		}
		function isName(str)          // 判断用户名格式是否正确
	    {  
			var rx = /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/;  
			return rx.test(str);  
		}   
		
	</script> 
	
</head>

<body>

    <!-- Start: Preloader -->
    <div id="preloader">
        <div id="loader"></div>
    </div>
    <!-- End: Preloader -->

    <!-- Start: Main Content -->
    <div class="main-container">
        
        <!-- Start: Home -->
        <section class="home-section">
            <div class="container" style="margin-top: 80px">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<h1 style="color: FFFFFF">图书商城</h1>
					</div>
				</div>
            </div>
        </section>
        <!-- End: Home -->
		
		<!-- Start: Content -->
        <section class="content-section">
            <div class="container">
				
			
				<div class="row">
					<div class="col-md-12" align="center">
						<h2 class="page-header"><span>欢迎登录</span></h2>
					</div>
					<div class="col-xs-12">
						<div class="" align="center">
							<form name="form1" action="LoginUser.do" method="post">
								<div class="form-group" align="center" style="padding-top: 40px">
									<label for="exampleInputEmail1">用户名</label>
									<input type="text" name="uname" class="form-control" id="exampleInputEmail1" placeholder="请输入用户名" style="width: 300">
								</div>
								<div class="form-group" align="center">
									<label for="exampleInputPassword1">密码</label>
									<input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="请输入密码" style="width: 300">
								</div>
								<div class="form-group" align="center">
									<label for="exampleInputPassword1">验证码</label>
									<input type="text" name="rand" class="form-control" style="width: 300" placeholder="请输入下方的验证码">
									<img alt="code..." name="randImage" id="randImage" src="image.jsp" width="60" height="20" border="1" align="absmiddle">
									<a href="javascript:loadimage();"><font class=pt95>看不清点我</font></a>
								</div>
								<br/>
								<button type="submit" class="btn btn-primary-alt" name="login" onclick="return checkValidate();">登录</button>
								</form>
								<button onclick="window.open('register.jsp')" class="btn btn-primary-alt">还没账号？去注册</button>
							
						</div>
					</div>
				
            </div>
        </section>
        <!-- End: Content -->
        
        <!-- Start: Footer-->
        <footer class="footer">
            <p>Copyright &copy; 2017.Company name All rights reserved.</p>
        </footer>
        <!-- End: Footer -->
        
    </div>
    <!-- End: Main Content -->
    
    <!-- Javascript Files -->
    <script type="text/javascript" src="js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	<script type="text/javascript" src="js/jquery.knob.min.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
</body>
</html>
